function insert(string, pos, ins) {
    before_tmp = substr(string, 1, pos)
    after_tmp = substr(string, pos + 1)
    return before_tmp INS after_tmp
}

# Note that when calling a user-defined function, there can be no spaces
# between the function name and the left parenthesis. This is not true of
# built-in functions.

print insert($1, 4, "XX")

# When we call the insert() function, and specify $1 as the first argument,
# then a _copy_ of that variables is passed to the function


# local and global variables
# it is usually a good idea to eliminate global variables
# in a function.
